class TT extends Thread{
	private static int i;
	private volatile String name;
	TT(int i,String n){
		this.i = i;
		name = n;
		setDaemon(true);
		start();
	}
	public void run(){
		while(true){
			i++;
			try{
				sleep(100);
			}catch(InterruptedException e){
				System.out.println("The thread is interrupted. "+this.name);
			}
			System.out.println(this.name);
			return;
		}
	}
}
class DaemonTest {
	public static void main(String args[]){
		TT t[] = new TT[5];
		for(int i=0;i<5;i++){
			t[i]= new TT(i,"Thread");
			try{
				Thread.sleep(10);
			}catch(InterruptedException e){
				System.out.println("Interrupted.");
			}
		}
		try{
			Thread.sleep(20);
		}catch(InterruptedException e){
			System.out.println("The main is interrupted.");
		}
	}
}
